﻿<!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
-->

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="using:WinRTXamlToolkit.Controls"
    xmlns:controlsPrimitives="using:WinRTXamlToolkit.Controls.Primitives">
    <ResourceDictionary.ThemeDictionaries>
        <ResourceDictionary
            x:Key="Light">
            <SolidColorBrush
                x:Key="CalendarButtonSelectedBackgroundFillBrush"
                Color="#40000000" />
            <SolidColorBrush
                x:Key="CalendarButtonBackgroundHighlightBrush"
                Color="#20000000" />
            <SolidColorBrush
                x:Key="CalendarButtonHighlightTextBrush"
                Color="#FF000000" />
            <SolidColorBrush
                x:Key="CalendarButtonForeground"
                Color="#FF000000" />
        </ResourceDictionary>
        <ResourceDictionary
            x:Key="Default">
            <SolidColorBrush
                x:Key="CalendarButtonSelectedBackgroundFillBrush"
                Color="#40FFFFFF" />
            <SolidColorBrush
                x:Key="CalendarButtonBackgroundHighlightBrush"
                Color="#20FFFFFF" />
            <SolidColorBrush
                x:Key="CalendarButtonHighlightTextBrush"
                Color="#FFFFFFFF" />
            <SolidColorBrush
                x:Key="CalendarButtonForeground"
                Color="#FFFFFFFF" />
        </ResourceDictionary>
    </ResourceDictionary.ThemeDictionaries>

    <x:Double
        x:Key="CalendarButtonFontSize">36</x:Double>

    <!-- CalendarButton Style -->
    <Style
        TargetType="controlsPrimitives:CalendarButton">
        <Setter
            Property="FontFamily"
            Value="{StaticResource ContentControlThemeFontFamily}" />
        <Setter
            Property="FontSize"
            Value="{StaticResource CalendarButtonFontSize}" />
        <Setter
            Property="HorizontalContentAlignment"
            Value="Center" />
        <Setter
            Property="VerticalContentAlignment"
            Value="Center" />
        <Setter
            Property="UseLayoutRounding"
            Value="False" />
        <Setter
            Property="MinWidth"
            Value="50.75" />
        <Setter
            Property="MinHeight"
            Value="48" />
        <Setter
            Property="Padding"
            Value="20" />
        <Setter
            Property="Template">
            <Setter.Value>
                <ControlTemplate
                    TargetType="controlsPrimitives:CalendarButton">
                    <Grid
                        UseLayoutRounding="False">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup
                                x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition
                                        From="Normal"
                                        GeneratedDuration="0:0:0"
                                        To="PointerOver" />
                                </VisualStateGroup.Transitions>
                                <VisualState
                                    x:Name="Normal" />
                                <VisualState
                                    x:Name="PointerOver">
                                    <Storyboard>
                                        <DoubleAnimation
                                            Duration="0"
                                            Storyboard.TargetName="Background"
                                            Storyboard.TargetProperty="Opacity"
                                            To=".5" />
                                        <ObjectAnimationUsingKeyFrames
                                            Storyboard.TargetName="Content"
                                            Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame
                                                KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames
                                            Storyboard.TargetName="ContentActive"
                                            Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame
                                                KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState
                                    x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation
                                            Duration="0"
                                            Storyboard.TargetName="Background"
                                            Storyboard.TargetProperty="Opacity"
                                            To=".5" />
                                        <ObjectAnimationUsingKeyFrames
                                            Storyboard.TargetName="ContentActive"
                                            Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame
                                                KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames
                                            Storyboard.TargetName="Content"
                                            Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame
                                                KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup
                                x:Name="SelectionStates">
                                <VisualState
                                    x:Name="Unselected" />
                                <VisualState
                                    x:Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimation
                                            Duration="0"
                                            Storyboard.TargetName="SelectedBackground"
                                            Storyboard.TargetProperty="Opacity"
                                            To=".75" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup
                                x:Name="ActiveStates">
                                <VisualState
                                    x:Name="Active" />
                                <VisualState
                                    x:Name="Inactive">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames
                                            Storyboard.TargetName="Content"
                                            Storyboard.TargetProperty="Opacity">
                                            <EasingDoubleKeyFrame
                                                KeyTime="0"
                                                Value="0.5" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup
                                x:Name="CalendarButtonFocusStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition
                                        From="CalendarButtonUnfocused"
                                        GeneratedDuration="0:0:0"
                                        To="CalendarButtonFocused" />
                                </VisualStateGroup.Transitions>
                                <VisualState
                                    x:Name="CalendarButtonFocused">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames
                                            Storyboard.TargetName="FocusVisualWhite"
                                            Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame
                                                KeyTime="0"
                                                Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames
                                            Storyboard.TargetName="FocusVisualBlack"
                                            Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame
                                                KeyTime="0"
                                                Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState
                                    x:Name="CalendarButtonUnfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Rectangle
                            x:Name="SelectedBackground"
                            Fill="{StaticResource CalendarButtonSelectedBackgroundFillBrush}"
                            Opacity="0" />
                        <Rectangle
                            x:Name="Background"
                            Fill="{StaticResource CalendarButtonBackgroundHighlightBrush}"
                            StrokeThickness="1"
                            Opacity="0" />
                        <ContentControl
                            x:Name="Content"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"
                            Foreground="{StaticResource CalendarButtonForeground}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            Margin="{TemplateBinding Padding}"
                            IsTabStop="False" />
                        <ContentControl
                            x:Name="ContentActive"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"
                            Foreground="{StaticResource CalendarButtonHighlightTextBrush}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            Margin="{TemplateBinding Padding}"
                            IsTabStop="False"
                            Visibility="Collapsed" />
                        <Rectangle
                            x:Name="FocusVisualWhite"
                            IsHitTestVisible="False"
                            Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}"
                            StrokeEndLineCap="Square"
                            StrokeDashArray="1,1"
                            Opacity="0"
                            StrokeDashOffset="1.5" />
                        <Rectangle
                            x:Name="FocusVisualBlack"
                            IsHitTestVisible="False"
                            Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}"
                            StrokeEndLineCap="Square"
                            StrokeDashArray="1,1"
                            Opacity="0"
                            StrokeDashOffset="0.5" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>